/*
 * MIT License
 *
 * Copyright (c) 2023 北京凯特伟业科技有限公司
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
package com.je.bpm.engine.runtime;

import com.je.bpm.engine.internal.Internal;

/**
 * Represent a 'path of execution' in a process instance.
 * <p>
 * Note that a {@link ProcessInstance} also is an execution.
 */
@Internal
public interface Execution {

    /**
     * The unique identifier of the execution.
     */
    String getId();

    /**
     * Indicates if the execution is suspended.
     */
    boolean isSuspended();

    /**
     * Indicates if the execution is ended.
     */
    boolean isEnded();

    /**
     * Returns the id of the activity where the execution currently is at. Returns null if the execution is not a 'leaf' execution (eg concurrent parent).
     */
    String getActivityId();

    /**
     * Id of the root of the execution tree representing the process instance. It is the same as {@link #getId()} if this execution is the process instance.
     */
    String getProcessInstanceId();

    /**
     * Gets the id of the parent of this execution. If null, the execution represents a process-instance.
     */
    String getParentId();

    /**
     * Gets the id of the super execution of this execution.
     */
    String getSuperExecutionId();

    /**
     * Id of the root of the execution tree representing the process instance that has no super execution.
     */
    String getRootProcessInstanceId();

    /**
     * Returns Id of the process instance related to the super execution of this execution.
     */
    String getParentProcessInstanceId();

    /**
     * The tenant identifier of this process instance
     */
    String getTenantId();

    /**
     * Returns the name of this execution.
     */
    String getName();

    /**
     * Returns the description of this execution.
     */
    String getDescription();
}
